{extend name="public:base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">
        <form action="{:url('admin/config/index')}" class="layui-form" method="get">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input type="text" name="title" value="{:input('title')}" autocomplete="off" placeholder="请输入标题" class="layui-input"/>
                </div>
                <div class="layui-input-inline">
                    <select name="group">
                        <option value="">全部分组</option>
                        {foreach name=":config('configGroup')" key="k" item="v"}
                        <option value="{$k}" {if condition="input('group') eq $k"}selected="selected"{/if}>{$v}[{$k}]</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-input-inline">
                    <button class="layui-btn layui-btn-primary ajax-search"><i class="fa fa-search"></i></button>
                </div>
            </div>
        </form>
    </div>
    <div class="layui-card-body">
        <div class="layui-btn-group">
            <a href="{:url('admin/config/add')}" class="layui-btn"><i class="fa fa-plus-circle"></i> 添加配置</a>
        </div>
        <table class="layui-table layui-form">
            <thead>
            <tr>
                <th>ID</th>
                <th>配置分组</th>
                <th>配置标题</th>
                <th>配置标识</th>
                <th>配置类型</th>
                <th>调用方式</th>
                <th>排序</th>
                <th>状态</th>
                <th width="120">操作</th>
            </tr>
            </thead>
            <tbody>
            {foreach name="list" item="v"}
            <tr>
                <td>{$v.id}</td>
                <td>{:config('configGroup')[$v.group]}[{$v.group}]</td>
                <td>{$v.title}</td>
                <td>{$v.name}</td>
                <td>{:config('configType')[$v.type]}[{$v.type}]</td>
                <td>config('{$v.group}.{$v.name}')</td>
                <td>
                    <input type="text" name="sort_order" value="{$v.sort_order}" autocomplete="off" class="layui-input ajax-update" data-url="{:url('admin/config/edit', ['id' => $v.id])}">
                </td>
                <td>
                    <input type="checkbox" name="status" lay-skin="switch" lay-filter="*" lay-text="启用|禁用" data-url="{:url('admin/config/edit', ['id' => $v.id])}" {if $v.status eq 1}checked="checked"{/if}>
                </td>
                <td>
                    <a href="{:url('admin/config/edit', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-edit"></i> 编辑</a>
                    <a href="{:url('admin/config/del', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-danger ajax-delete"><i class="fa fa-trash-o"></i> 删除</a>
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        <div class="page">{$list->render()}</div>
    </div>
</div>
{/block}
